<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/header.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DSP</title>
<%@include file="../common/link.jsp"%>
<script>
	var config = {
		url : 'jms',
		query_url :'jms_query',
		page : 1,
		rp : 4
	}
	var colModel = [{
		title :'任务名称', field:'jmsContent',width : 120 , align : 'left' ,
		formatter : function(cell , rowData , index){
			var value = "<a href='###' onclick='javascript:showTask(\""+ rowData.linkTo+"\",\""+ rowData.id+"\")'>"+ cell + "</a>";
			if(rowData.status == 0){
				value += "&nbsp;&nbsp;&nbsp;<font color='red'><i>new</i></font>";
			}
			return value;
		}
	}, {
		title :'计算时间', field:'jobsTime' , width:120 , align:'left' , 
		formatter:function(cell , rowData , index){
			return new Date(cell).format('yyyy-MM-dd hh:mm:ss');
		}
	}];
	function showTask(url , id){
		$("#dialog_div").window('open');
		DSP.Server(url , {jobs:id} , function(json){
			var rows = json.rows;
			var values = '<ul>';
			$.each(rows , function(){
				values += '<li>'+ this.errorInfo+'</li>';
			});
			values +='</ul>';
			$("#taskBody").empty("").append(values);
		} , DSP.contentType);
	}
</script>
</head>

<body>
<div id="dialog_div" class="easyui-window" title="任务信息"
	collapsible="false" minimizable="false" maximizable="false"
	icon="icon-save"
	style="width: 310px; height: 310px; left: 200px; top: 50px; padding: 5px; background: #fafafa;">
	<div class="easyui-layout" fit="true">
		<div region="center" border="false"
			style="padding: 10px; background: #fff; border: 1px solid #ccc;">
				<div id="taskBody"></div>
			</div>
		</div>
</div>
				
<table id="xDataGrid"></table>
<script type="text/javascript">
	$(function() {
		DSP.open(false,400 , 500 ,"");
		$("#xDataGrid").datagrid({
			height: 'auto',
			width:'auto',
			fitColumns : true, 
			method:'POST',
			singleSelect : true,
			pageSize : 15,
			pageList : [22],// 可以设置每页记录条数的列表
			nowrap :false,
			url : config.url+'_list',
			idField : 'id', 
			rownumbers : true, columns : [colModel],
			pagination : true
		})
	});
	</script>
</body>
</html>
